﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;

namespace WeChatSDK.WeChatDto.Conversation.ReceivingMessage.EventMessage
{
    /// <summary>
    /// 群发回调事件消息
    /// </summary>
    [XmlRoot(Namespace = "", IsNullable = false, ElementName = "xml")]
    public class MPCallbackEventMessageDto : EventMessageDto
    {
        /// <summary>
        /// 消息ID
        /// </summary>
        [XmlElement("MsgID", DataType = "long")]
        public long MessageID { get; set; }
        /// <summary>
        /// 群发的结构，为“send success”或“send fail”或“err(num)”。
        /// 但send success时，也有可能因用户拒收公众号的消息、系统错误等原因造成少量用户接收失败。
        /// err(num)是审核失败的具体原因，可能的情况如下： 
        /// err(10001), //涉嫌广告 err(20001), //涉嫌政治 err(20004), //涉嫌社会 err(20002), 
        /// //涉嫌色情 err(20006), //涉嫌违法犯罪 err(20008), //涉嫌欺诈 err(20013), 
        /// //涉嫌版权 err(22000), //涉嫌互推(互相宣传) err(21000), //涉嫌其他 err(30001) 
        /// // 原创校验出现系统错误且用户选择了被判为转载就不群发 err(30002) 
        /// // 原创校验被判定为不能群发 err(30003) 
        /// // 原创校验被判定为转载文且用户选择了被判为转载就不群发
        /// </summary>
        [XmlElement("Status", DataType = "string")]
        public string Status { get; set; }
        /// <summary>
        /// tag_id下粉丝数；或者openid_list中的粉丝数
        /// </summary>
        [XmlElement("TotalCount", DataType = "int")]
        public int TotalCount { get; set; }
        /// <summary>
        /// 过滤（过滤是指特定地区、性别的过滤、用户设置拒收的过滤，用户接收已超4条的过滤）后，
        /// 准备发送的粉丝数，原则上，FilterCount = SentCount + ErrorCount
        /// </summary>
        [XmlElement("FilterCount", DataType = "int")]
        public int FilterCount { get; set; }
        /// <summary>
        /// 发送成功的粉丝数
        /// </summary>
        [XmlElement("SentCount", DataType = "int")]
        public int SentCount { get; set; }
        /// <summary>
        /// 发送失败的粉丝数
        /// </summary>
        [XmlElement("ErrorCount", DataType = "int")]
        public int ErrorCount { get; set; }
        /// <summary>
        /// 版权检查结果
        /// </summary>
        [XmlElement(typeof(CopyrightCheckResultsDto))]

        public CopyrightCheckResultsDto CopyrightCheckResult { get; set; }
    }
    /// <summary>
    /// 版权检测结果
    /// </summary>
    [XmlType("CopyrightCheckResult")]
    public class CopyrightCheckResultsDto
    {
        /// <summary>
        /// 版权检查数量
        /// </summary>
        [XmlElement("Count", DataType = "int")]
        public int Count { get; set; }
        /// <summary>
        /// 整体校验结果
        /// 1-未被判为转载，可以群发，2-被判为转载，可以群发，3-被判为转载，不能群发
        /// </summary>
        [XmlElement("CheckState", DataType = "int")]
        public int CheckState { get; set; }
        /// <summary>
        /// 各个单图文校验结果
        /// </summary>
        [XmlArray("ResultList")]
        public List<CopyrightCheckResultsListDto> ResultList { get; set; }
    }
    /// <summary>
    /// 内容版权检测结果信息
    /// </summary>
    [XmlType("item")]
    public class CopyrightCheckResultsListDto
    {
        /// <summary>
        /// 群发文章的序号，从1开始
        /// </summary>
        [XmlElement("ArticleIdx", DataType = "int")]
        public int ArticleIdx { get; set; }
        /// <summary>
        /// 用户声明文章的状态
        /// </summary>
        [XmlElement("UserDeclareState", DataType = "int")]
        public int UserDeclareState { get; set; }
        /// <summary>
        /// 系统校验的状态
        /// </summary>
        [XmlElement("AuditState", DataType = "int")]
        public int AuditState { get; set; }
        /// <summary>
        /// 相似原创文的url
        /// </summary>
        [XmlElement("OriginalArticleUrl", DataType = "string")]
        public string OriginalArticleUrl { get; set; }
        /// <summary>
        /// 相似原创文的类型
        /// </summary>
        [XmlElement("OriginalArticleType", DataType = "int")]
        public int OriginalArticleType { get; set; }
        /// <summary>
        /// 是否能转载
        /// </summary>
        [XmlElement("CanReprint", DataType = "int")]
        public int CanReprint { get; set; }
        /// <summary>
        /// 是否需要替换成原创文内容
        /// </summary>
        [XmlElement("NeedReplaceContent", DataType = "int")]
        public int NeedReplaceContent { get; set; }
        /// <summary>
        /// 是否需要注明转载来源
        /// </summary>
        [XmlElement("NeedShowReprintSource", DataType = "int")]
        public int NeedShowReprintSource { get; set; }
    }
}
